#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include "weatherdata.h"
#include "weatherfetcher.h"
#include "weatherTool.h"
#include "parsejsoninfo.h"
#include "updateui.h"
#include "drawcurve.h"

class UpdateUI;
class DrawCurve;

#include <QMainWindow>
#include<QMouseEvent>
#include <QMenu>
#include<QAction>

// #include<QList>
// #include<QLabel>
// #include<QMap>
#include<QKeyEvent>
#include<QEvent>
#include<QPainter>
QT_BEGIN_NAMESPACE
namespace Ui {
    class MainWindow;
}
QT_END_NAMESPACE

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    MainWindow(QWidget* parent = nullptr);
    ~MainWindow();
    Ui::MainWindow* ui;
    static MainWindow* mywidget;
    // static MainWindow* drawWidget;

private:
    QMenu* mExitMenu;//退出菜单
    QAction* mExitAction;//退出菜单项
    QAction *mRefreshAct;
    QPoint moffset;                 // 鼠标相对窗口左上角的偏移量
    QMap<QString, QString> weatherIcon; //天气映射
    WeatherFetcher* mFetcher; //天气获取器
    ParseJsonInfo* mParseJsonInfo; //解析json信息
    UpdateUI* mUpdateUI; //更新UI
    DrawCurve* mDrawCurve;//绘制曲线

protected:
    //*关闭菜单
    virtual void contextMenuEvent(QContextMenuEvent* event) override;
    //鼠标移动窗口
    virtual void mouseMoveEvent(QMouseEvent* event) override;
    //*鼠标点击窗口
    virtual void mousePressEvent(QMouseEvent* event) override;
    //*按enter也可以实现搜索
    virtual void keyPressEvent(QKeyEvent* event) override;
private slots:
    void on_btnSearch_clicked();
};
#endif // MAINWINDOW_H
